﻿//-----------------------------------------------------------------------
// <copyright file="DepthFirstStrategy.cs" company="tuliprules.org">
//     Copyright (c) 2010 tuplelister, tuliprules.org.
// </copyright>
// <summary>This is the DepthFirstStrategy class.</summary>
//-----------------------------------------------------------------------

namespace Tulip.Engine.ConflictResolution
{
    /// <summary>
    /// Depth-First conflict resolution strategy.
    /// </summary>
    /// <remarks>
    /// <para>Newly activated productions are placed above all productions of the same salience.</para> 
    /// <para>Example:  Consider the following scenario:</para>
    /// <para>          * All productions have equal saliance
    ///           * Fact A activates Production 1 and Production 2
    ///           * Fact B activates Production 3 and Production 4</para>
    /// <para>          If Fact A is asserted before Fact B, Production 3 and Production 4 will  
    ///           be above Production 1 and Production 2 on the agenda. The position of 
    ///           Production 1 relative to Production 2 and Production 3 relative to 
    ///           Production 4 will be arbitrary.</para>
    /// </remarks>
    public class DepthFirstStrategy : ConflictResolutionStrategy
    {
        /// <summary>
        /// Factory method returns a new agenda.
        /// </summary>
        /// <returns>A new agenda.</returns>
        public override Agenda NewAgenda()
        {
            return new Agenda(this);
        }

        /// <summary>
        /// Factory method creates a new agenda list.
        /// </summary>
        /// <returns>A new agenda list.</returns>
        public override IAgendaList CreateAgendaList()
        {
            return new DepthFirstAgendaList();
        }
    }
}
